package moe.rename;

import java.io.File;

public class RenameAction {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if (args.length < 1) {
			System.out
					.println("Optional parameters: \n\tm2t - Rename MD5 to Tags\n\tt2m - Rename Tags to MD5");
			return;
		}
		updateUserDir();
		if ("m2t".equals(args[0])) {
			System.out.println("Rename: MD5 to Tags");
			new RenameMD5ToTags().execute();
		} else if ("t2m".equals(args[0])) {
			System.out.println("Rename: Tags to MD5");
			new RenameTagsToMD5().execute();
		} else {
			System.out.println("Invalid argument: " + args[0]);
			return;
		}
		System.out.println("Rename finish!");
	}

	private static void updateUserDir() {
		File userDir = new File(System.getProperty("user.dir"));
		String newUserDir = userDir.getParent();
		if (newUserDir != null) {
			System.setProperty("user.dir", newUserDir);
		}
	}

}
